package com.carbohydrate42.kotlin_compose_demo.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.carbohydrate42.kotlin_compose_demo.entity.User

@Dao
interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun save(user: User)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun saveAll(users: List<User>)

    @Query("select * from test_user")
    suspend fun findAll(): List<User>

    @Query("select * from test_user where id =:id")
    suspend fun findById(id: Long): User?
}